#!/usr/bin/env python

"""
	__author__ 	= "Vishal Patil"
	__copyright__	= "Copyright (C) 2006 Vishal Patil"
"""

#
# 	Base class for a gene. All new genes should be derived from this class. 
#	The important functions that needs to be implemented in the derived class
#	are clone, setBounds, mutate, setRandomValue. Have a look at the FloatGene
#	and IntegerGene for examples of this
#
class Gene:
	allele = None

	def getAllele(self,allele = None):
		self.allele = allele
	
	#
	# 	Create a new instance of the gene with default initial values
	#
	def newGene(self):
		pass

	def applyMutation(self,mutationPercentage):
		self.mutationPercentage = mutationPercentage	
	
	#
	#	Create a clone of the gene.  
	#
	def clone(self):
		cloneGene = Gene()
		cloneGene.allele = allele
		return cloneGene
	
	#
	#	Mutate the gene
	#
	def mutate(self):
		pass

	#
	#	Set a random value for the gene withing the specified bounds
	#
	def setRandomValue(self):
		pass

	def __repr__(self):
		return "Gene"
	
	def __str__(self):
		return "Gene"

	def __cmp__(self):
		pass
